<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="resources/scripts/jquery-1.7.1.min.js"></script>
    <script src="resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
    <script src="resources/scripts/axure/axQuery.js"></script>
    <script src="resources/scripts/axure/globals.js"></script>
    <script src="resources/scripts/axutils.js"></script>
    <script src="resources/scripts/axure/annotation.js"></script>
    <script src="resources/scripts/axure/axQuery.std.js"></script>
    <script src="resources/scripts/axure/doc.js"></script>
    <title>Document</title>
    <style>
        body {
            background-color: rgb(180, 206, 243);
            font-size: 20px;
        }

        .index {
            padding-top: 100px;
            padding-bottom: 100px;
            margin: auto;
            width: 920px;
            background-color: white;
            box-shadow: 10px 10px 15px black;
            margin-top: 50px;
        }

        form {
            padding-left: 100px;
            line-height: 180%;
        }

        p {
            line-height: 180%;
        }

        #btn {
            background-color: #425fc9;
            color: white;
            padding: 5px 10px;
            margin-left: 320px;
            margin-top: 16px;
            margin-bottom: 20px;
            font-size: 20px;
        }

        table {
            text-align: center;
        }
    </style>
</head>

<body>
    <div class="index">
        <p style="font-size:30px;text-align: center;">教学类软件评价指标重要性调查问卷</p>
        <div class="result" style="width:75% ;margin: auto;">
            <ol>
                <table width="600" border="1" cellspacing="0" id="mytable">
                    <thead>
                        <tr>
                            <th>协调系数</th>
                        </tr>
                    </thead>
                    <tbody id="tb"></tbody>
                </table><br>
            </ol>
        </div>
        <form method="get" action="" id="tform">
            <ol>
                <label style="visibility: hidden;"><input id="us" type="radio" name="username" value="username" checked="checked" />&nbsp;&nbsp;特别熟悉 </label>        
            </ol>
        </form>
    </div>
    <script>
        var loc = location.href;
        var n1 = loc.length;
        var n2 = loc.indexOf('=')
        if (n2 >= 0 && n2 <= n1) {
            var n3 = loc.substring(n2 + 1);
            var username = n3;
            username = username.toString();
            var data = {
                username
            }
            console.log("data:", data)
            document.getElementById("us").value = username;

            $.get('/du', data, function (re) {
                //10行5列
                var m=10;
                var n=5;
                let sArray=new Array();
                for (var i=0;i<m;i++){
                    sArray[i]=new Array();
                    for(var j=0;j<n;j++){
                        sArray[i][j]=0;
                    }
                }
                var rows=re;
                var i=0;
                while(i<rows.length){
                    if (rows[i].user=="zj1"){
                        if (rows[i].wt=="sx")
                        sArray[0][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[0][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[0][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[0][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[0][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj2"){
                        if (rows[i].wt=="sx")
                        sArray[1][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[1][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[1][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[1][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[1][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj3"){
                        if (rows[i].wt=="sx")
                        sArray[2][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[2][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[2][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[2][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[2][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj4"){
                        if (rows[i].wt=="sx")
                        sArray[3][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[3][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[3][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[3][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[3][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj5"){
                        if (rows[i].wt=="sx")
                        sArray[4][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[4][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[4][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[4][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[4][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj6"){
                        if (rows[i].wt=="sx")
                        sArray[5][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[5][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[5][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[5][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[5][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj7"){
                        if (rows[i].wt=="sx")
                        sArray[6][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[6][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[6][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[6][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[6][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj8"){
                        if (rows[i].wt=="sx")
                        sArray[7][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[7][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[7][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[7][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[7][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj9"){
                        if (rows[i].wt=="sx")
                        sArray[8][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[8][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[8][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[8][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[8][4]=parseInt(rows[i].answer);
                    }
                    if (rows[i].user=="zj10"){
                        if (rows[i].wt=="sx")
                        sArray[9][0]=parseInt(rows[i].answer);
                        if (rows[i].wt=="gn")
                        sArray[9][1]=parseInt(rows[i].answer);
                        if (rows[i].wt=="jg")
                        sArray[9][2]=parseInt(rows[i].answer);
                        if (rows[i].wt=="sp")
                        sArray[9][3]=parseInt(rows[i].answer);
                        if (rows[i].wt=="xx")
                        sArray[9][4]=parseInt(rows[i].answer);
                    }
                    
                    i=i+1;
                }//while循环
                let ss=new Array(5);
                ss[0]=sArray[0][0]+sArray[1][0]+sArray[2][0]+sArray[3][0]+sArray[4][0]+sArray[5][0]+sArray[6][0]+sArray[7][0]+sArray[8][0]+sArray[9][0];
                ss[1]=sArray[0][1]+sArray[1][1]+sArray[2][1]+sArray[3][1]+sArray[4][1]+sArray[5][1]+sArray[6][1]+sArray[7][1]+sArray[8][1]+sArray[9][1];
                ss[2]=sArray[0][2]+sArray[1][2]+sArray[2][2]+sArray[3][2]+sArray[4][2]+sArray[5][2]+sArray[6][2]+sArray[7][2]+sArray[8][2]+sArray[9][2];
                ss[3]=sArray[0][3]+sArray[1][3]+sArray[2][3]+sArray[3][3]+sArray[4][3]+sArray[5][3]+sArray[6][3]+sArray[7][3]+sArray[8][3]+sArray[9][3];
                ss[4]=sArray[0][4]+sArray[1][4]+sArray[2][4]+sArray[3][4]+sArray[4][4]+sArray[5][4]+sArray[6][4]+sArray[7][4]+sArray[8][4]+sArray[9][4];

                var s=(ss[0]+ss[1]+ss[2]+ss[3]+ss[4])/5;

                let dd=new Array(5);

                dd[0]=ss[0]-s;
                dd[1]=ss[1]-s;
                dd[2]=ss[2]-s;
                dd[3]=ss[3]-s;
                dd[4]=ss[4]-s;

                var a=100*(5*5*5-5);
                var b=dd[0]*dd[0]+dd[1]*dd[1]+dd[2]*dd[2]+dd[3]*dd[3]+dd[4]*dd[4];
                var w=(12/a)*b;
                l=w.toString();
                l=l.replace(/^(.*\..{4}).*$/,"$1");
                w=parseFloat(l);


                var per = [{
                        n: w
                    }
                ];
                var tb = document.getElementById('tb');
                for (var i = 0; i < per.length; i++) {
                    var trow = getDataRow(per[i], i);
                    tb.appendChild(trow);
                }

                function getDataRow(h) {
                    var row = document.createElement('tr');

                    var numCell = document.createElement('td');
                    numCell.innerHTML = h.n;
                    row.appendChild(numCell);
                   return row;

                }

            }) //get
        } else {
            alert("非法进入！");
            window.location = "index.html"
        }
    </script>
</body>

</html>